package com.sdx.console.base.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.base.dao.BaseMessageDao;
import com.sdx.console.base.entity.BaseMessage;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 消息管理 Service
 */

@Service
@Transactional
public class BaseMessageService extends BaseService<BaseMessage>{

    @Resource
	private BaseMessageDao baseMessageDao;

    public PageQuery<BaseMessage>queryByCondition(PageQuery query){
        PageQuery ret =  baseMessageDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelBaseMessage(List<String> ids){
        try {
            baseMessageDao.batchDelBaseMessageByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除消息管理失败", e);
        }
    }

	public List<BaseMessage> all() {
		return baseMessageDao.all();
		}

    public void setTop(List<String> ids,BaseMessage baseMessage) {
        try {
            baseMessageDao.setTop(ids,baseMessage);
        } catch (Exception e) {
            throw new PlatformException("批量置顶失败", e);
        }
    }
}